package com.love.common.util;

import com.love.common.enums.ResultCodeEnum;
import com.love.common.vo.RespResultVO;

/**
 * TODO description
 *
 * @author sunbo
 * @date 2021/5/13 上午11:26
 */
public class RespUtil {

    public static RespResultVO success(Object o) {
        return RespResultVO.builder()
                .code(ResultCodeEnum.SUCCESS.getCode())
                .msg(ResultCodeEnum.SUCCESS.getMsg())
                .data(o)
                .build();
    }

    public static RespResultVO success() {
        return success(null);
    }

    public static RespResultVO fail(ResultCodeEnum codeEnum) {
        return RespResultVO.builder()
                .code(codeEnum.getCode())
                .msg(codeEnum.getMsg())
                .build();
    }

}
